package com.geek.water.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.geek.water.entity.BillDetail;
import com.geek.water.mapper.BillDetailMapper;
import com.geek.water.service.BillDetailService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author yangwenqi
 * @decs 账单明细服务实现类
 * @date 2025/8/5
 */
@Service
public class BillDetailServiceImpl extends ServiceImpl<BillDetailMapper, BillDetail> implements BillDetailService {

    @Override
    public List<BillDetail> getDetailsByBillId(Long billId) {
        LambdaQueryWrapper<BillDetail> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(BillDetail::getBillId, billId);
        return this.list(queryWrapper);
    }

    @Override
    public List<BillDetail> getDetailsByDeviceAndPeriod(Long deviceId, String billingPeriod) {
        LambdaQueryWrapper<BillDetail> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(BillDetail::getDeviceId, deviceId);
        queryWrapper.eq(BillDetail::getBillingPeriod, billingPeriod);
        return this.list(queryWrapper);
    }
}